package classtest_domain;

/**
 * @version 1.0
 * @auther liquan
 * @date 2025/3/18 14:03
 * @description 矩形类
 */
public class Rectangle {
    // 私有属性
    private double chang;
    private double kuan;

    // 公开的行为
    // 面积
    public double getArea(){
        return chang * kuan;
    }
    // 周长
    public double getPerimeter(){
        return 2 * (chang + kuan);
    }
    // getinfo()返回矩形对象信息
    public String getInfo(){
        return"长：" + chang + "，宽：" + kuan + "，面积：" + getArea() + ",周长：" + getPerimeter();
    }

    // 无参和满参构造
    public Rectangle() { // 无参
    }

    public Rectangle(double chang, double kuan) { // 满参
        this.chang = chang;
        this.kuan = kuan;
    }

    // getter  and  setter
    public double getChang() {
        return chang;
    }

    public void setChang(double chang) {
        this.chang = chang;
    }

    public double getKuan() {
        return kuan;
    }

    public void setKuan(double kuan) {
        this.kuan = kuan;
    }
}
